<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>党建后台</title>
    <meta name="keywords"  />
    <meta name="description"  />
    <link rel="stylesheet" type="text/css" href="/dangjian/Public/layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="/dangjian/Public/bootstrap/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/dangjian/Public/Admin/Css/identify.css" />
    <link rel="stylesheet" type="text/css" href="/dangjian/Public/Admin/Css/layout.css" />
    <link rel="stylesheet" type="text/css" href="/dangjian/Public/Admin/Css/account.css" />
    <link rel="stylesheet" type="text/css" href="/dangjian/Public/Admin/Css/style.css" />
    <link rel="stylesheet" type="text/css" href="/dangjian/Public/Admin/Css/control_index.css" />
    <link rel="stylesheet" type="text/css" href="/dangjian/Public/Admin/Css/index.css" />

    <link rel="stylesheet" type="text/css" href="/dangjian/Public/Admin/Css/page.css" />

    <script type="text/javascript" src="/dangjian/Public/Admin/Js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/dangjian/Public/layui/layui.js"></script>
    <script type="text/javascript" src="/dangjian/Public/Admin/Js/layer/layer.js"></script>
    <script type="text/javascript" src="/dangjian/Public/Admin/Js/haidao.offcial.general.js"></script>
    <script type="text/javascript" src="/dangjian/Public/Admin/Js/select.js"></script>
    <script type="text/javascript" src="/dangjian/Public/Admin/Js/haidao.validate.js"></script>

    <script type="text/javascript" charset="utf-8" src="/dangjian/Public/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/dangjian/Public/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/dangjian/Public/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>

<body>

    <!--<div class="view-product" style="margin-top: 50px">-->
    <div class="info-center">
        <div class="manage-head">
            <h6 class="padding-left manage-head-con"><?php echo ($title); ?></h6>
        </div>
        <a href="<?php echo ($prev); ?>" class="layui-btn layui-btn-normal" style="margin: 20px 0 0 20px">返回上一页</a>
        <div class="layui-container" style="margin-top: 20px">
            <div class="layui-row">

                <div class="layui-col-md5 layui-col-md-offset1">
                    <form class="layui-form" action="<?php echo U('Article/saveArtc');?>" method="post" enctype="multipart/form-data" id="add">
                        <div class="layui-form-item">
                            <label class="layui-form-label">标题</label>
                            <div class="layui-input-inline">
                                <input type="text" name="title"  autocomplete="off" class="layui-input" lay-verify="required" required>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">简短描述(文字)</label>
                            <div class="layui-input-inline">
                                <input type="text" name="description"  autocomplete="off" class="layui-input" lay-verify="required" required>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">文章分类</label>
                            <div class="layui-input-inline">
                                <select name="sort" lay-search="" class="form-control">
                                    <?php if(is_array($sortList)): foreach($sortList as $key=>$val): if(($val["is_use"]) == "1"): ?><option value="<?php echo ($val["id"]); ?>"><?php echo ($val["name"]); ?></option><?php endif; endforeach; endif; ?>

                                </select>
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <label class="layui-form-label">内容</label>
                            <div class="layui-input-inline" style="z-index: 998">
                                <script id="editor" name = "content" type="text/plain" style="width:1024px;height:500px;"></script>                                             </div>
                        </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                <button class="layui-btn" lay-submit >立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                                </div>
                                </form>

                                </div>
                                </div>
                                </div>
                                <script>
                            var ue = UE.getEditor('editor',{  //intro_detail为要编辑的textarea的id
                                initialFrameWidth: 1000,  //初始化宽度
                                initialFrameHeight: 300,  //初始化高度
                            });
                            ue.ready(function(){
                                ue.setHeight(300);
                            });

                            // Demo
                            layui.use('form', function(){
                                var form = layui.form;

                                //监听提交
                                form.on('submit(formDemo)', function(data){
                                    layer.msg(JSON.stringify(data.field));
                                    return false;
                                });
                            });
                            layui.use('laydate', function(){
                                var laydate = layui.laydate;
                                //日期时间选择器
                                laydate.render({
                                    elem: '#test1'
                                    ,type: 'month'
                                });
                                laydate.render({
                                    elem: '#test2'
                                    ,type: 'month'

                                });
                                laydate.render({
                                    elem: '#test3'
                                });
                                laydate.render({
                                    elem: '#test4'

                                });
                            });
                            $("#add").submit(function(){
                                // var s=ue.getPlainTxt();
                                // alert(s.length > 1);
                                // return false;
                                var s=ue.getPlainTxt();
                                if(s.length > 1){
                                    return false;
                                }else{
                                    layer.alert("内容不能为空");
                                    return false;
                                }
                            })
                                </script>

                            </div>
                            <!--</div>-->


<script>
    function iFrameHeight(f) {
        // f.src
        // var iframeWindow = document.getElementById('iframepage').contentWindow;
        // var currentHref = iframeWindow.document.location.href;
        // console.log(currentHref);
        var ifm= document.getElementById("iframepage");
        var subWeb = document.frames ? document.frames["iframepage"].document : ifm.contentDocument;
        if(ifm != null && subWeb != null) {
            ifm.height = subWeb.body.scrollHeight;
            ifm.width = subWeb.body.scrollWidth;
        }
    }

    function prev(){
        window.location.href = document.getElementById('iframepage').previousSrc;
    }
    // window.location.replace($("#iframepage").src());
    // window.location.href = $("#iframepage").src();
    // var ifm= document.getElementById("iframepage");
    // ifm.height=document.documentElement.clientHeight;
    $(".sidebar-title").live('click', function() {
        if ($(this).parent(".sidebar-nav").hasClass("sidebar-nav-fold")) {
            $(this).next().slideDown(200);
            $(this).parent(".sidebar-nav").removeClass("sidebar-nav-fold");
            $(this).parent(".sidebar-nav").siblings(".sidebar-nav").addClass("sidebar-nav-fold");
            $(this).parent(".sidebar-nav").siblings(".sidebar-nav").children(".sidebar-title").next().slideUp(200);
        } else {
            $(this).next().slideUp(200);
            $(this).parent(".sidebar-nav").addClass("sidebar-nav-fold");
        }
    });
</script>
</body>

</html>